<%@ page import="xyc.sjxy.eljstl.pojo.Users" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%--el存取对象--%>
<%
    Users u = new Users();
    u.setId1(1001);
    u.setAge(20);
    u.setUserPwd("123");
    u.setUserName("tom");
    request.setAttribute("users",u);//将javaBean 存入到rquest域中
%>
<%--el取request域中对象:users--%>
${requestScope["users-01"]} <br>
${users} <br>
<%--表达式获取域对象中的属性--%>
${users.id1} <br>
${users.userName} <br>
${users.userPwd} <br>
${users.age} <br>
${users["age"]} <br> <%--这个和上面的是等价的--%>

<hr>
<%--el存取数组--%>
<%
    String[]str=new String[]{"tom","jhon","jetty"};
    request.setAttribute("users",str);//将数组str存入到rquest域中
%>
<%--el取request域中对象:user数组中的元素--%>
<%--${requestScope.users}--%>
${users[0]} <br>
${users[1]} <br>
${users[2]} <br>

<hr>
<%--el存取集合--%>
<%
    List list=new ArrayList();
    list.add(123);
    list.add(u);
    list.add("abc");
    request.setAttribute("list",list);//将集合list存入到rquest域中
%>
<%--el取request域中对象:list集合及元素--%>
${list} <br>
${list[0]} <br>
${list[1]} <br>
${list[1].id1} <br>
${list[1].userName} <br>
${list[1].userPwd} <br>
${list[1].age} <br>
${list[2]}
</body>
</html>
